<template>
  <el-form
    label-width="100px"
    class="cont"
  >
    <el-form-item label="邮箱">
      <el-input
        type="email"
        v-model="email"
        placeholder="请输入 Email..."
      ></el-input>
    </el-form-item>
    <el-form-item>
      <el-button type="primary" 
      @click="handleForgotPassword()" 
      class="submit-btn"
      >找回密码
      </el-button>
    </el-form-item>
  </el-form>
</template>

<script lang="ts">
import { defineComponent,getCurrentInstance,ref  } from 'vue'
import {useRouter} from 'vue-router'
export default defineComponent({
  name:"",
  props:{
    
  },
  setup() {
    // @ts-ignore
    const { proxy } = getCurrentInstance();
    const email = ref<string>("")
    const handleForgotPassword = async ()=>{
      console.log(email.value);
      if(email.value){
      // @ts-ignore
        const res = await proxy.$axios.post("/api/v1/auth/forgotpassword",
        {email:email.value});
        console.log(res.data);
      }
      
      
    }
    return {
      handleForgotPassword,
      email
    }
  }
})
</script>

<style>
.cont{
  margin: 100px auto 0 auto;
  width: 800px;
}
.submit-btn {
  width: 100%;
}
</style>